<%@ page contentType="text/html;charset=utf-8" language="java"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@include file="./common/base.jsp" %><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户中心_约导游</title>
<!--css-->
<link rel="stylesheet" type="text/css" href="css/wutongstyle.css">
</head>
<body>
<!--head begin-->
<%@ include  file="./common/header.jsp"%>
<!--nav end--> 
<!--content begin-->
<div class="wt_content">
  <dl class="yuedaoyou">
	<%@ include  file="./common/header2.jsp"%><dd>
    <dd>
      <div class="daoyou_info clearfix">
        <div class="xx_box">
          <div class="tainfobox yonghu">
            <h3 id="tuan"><i class="i_co"></i>处理新申请</h3>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="biaodan" id="applyListId">
              <tr>
                <td class="title">发团标题：</td>
                <td id="titleId"></td>
              </tr>
              <tr>
                <td class="title">出发时间：</td>
                <td id="startTimeId" ></td>
              </tr>
              <tr>
                <td class="title">出发地点：</td>
                <td id="sourcecityId" ></td>
              </tr>
              <tr>
                <td class="title">目的地：</td>
                <td id="targetcityId"></td>
              </tr>
              <tr>
                <td class="title">是否出境：</td>
                <td id="isoutboundId"></td>
              </tr>
              <tr>
                <td class="title">总天数：</td>
                <td id="daysId" >2</td>
              </tr>
              <!--  <tr>
                <td class="title">本行可删除：</td>
                <td><div class="tishi">以下新申请部分，程序注意，多个导游申请，只要接受任意一个导游，默认其他导游都是拒绝，这样不必每个导游都要操作了。</div></td>
              </tr>-->
              <span id="applyListId" class="applyCls">
              <span>
            </table>
            <h4>旅游行程</h4>
            <pre style="font-size:12px;word-break:break-all;word-wrap:break-word;" id="tripId"></pre>
          </div>
        </div>
        <div class="zp"><img id="headImgId" src="" width="185" height="90" />
          <div class="tel">
            <h4>快捷菜单</h4>
            <ul class="quick">
  			  <li><a href="lxslogin_1.jsp">发布新团信息</a></li>
              <li><a href="lxslogin.jsp">团信息列表</a></li>
              <li><a href="lxslogin_2.jsp" >新发团信息</a></li>
              <li><a href="lxslogin_3.jsp" class="on">已申请信息</a></li>
              <li><a href="lxslogin_4.jsp">已确认信息</a></li>
              <li><a href="lxslogin_6.jsp" >已发团信息</a></li>
              <li><a href="lxslogin_5.jsp">我的资料</a></li>
              <li><a href="lxslogin_7.jsp">站内短信列表</a></li>
            </ul>
          </div>
          <div class="yhsousuo">
            <h4>搜索导游信息</h4>
            <input type="text" value="填写城市名称">
            <button type="submit" value="搜索">搜索</button>
          </div>
        </div>
      </div>
    </dd>
  </dl>
</div>
<!--content end--> 
<!--footer begin-->
<%@ include  file="./common/footer.jsp"%>
<!--footer end-->
</body>
<script type="text/javascript">
var teamId = request("teamId");
$(function(){
	loadLxsTeamDetail(teamId);
	loadLxsGuideApplyList(teamId);
	$("#headImgId").attr("src",imgDomain+loginUserPhoto);
});
function loadLxsGuideApplyList(teamId){
	var objp={};
	 $.ajax({
		  url: '${path}/core/getApplyGuideListByTeamId?teamId='+teamId,
		  type: 'POST',
		  timeout: 30000,
		  cache : false,
	      data :objp,
	      async: false,
	      dataType:"json",      
         contentType:"application/json",   
	     // contentType: "application/json; charset=utf-8",
		  success:function(msg){
			  //alert(msg.totalCount)
			  formatLxsGuideApplyList(msg.guideList);
		  },
		   failure:function(msg){
			   alert(eval('('+msg.responseText+')').error_text);
		   		
		   },
		   error:function(msg){
			   alert(eval('('+msg.responseText+')').error_text); 
		   }
	});
}
function acceptApplyOpt(aGuideId){
	var objp={};
	 $.ajax({
		  url: '${path}/core/acceptApply?teamId='+teamId+"&guideId="+aGuideId,
		  type: 'POST',
		  timeout: 30000,
		  cache : false,
	      data :objp,
	      async: false,
	      dataType:"json",      
        contentType:"application/json",   
	     // contentType: "application/json; charset=utf-8",
		  success:function(msg){
			  //alert(msg.totalCount)
			  alert("ok");history.go(-1);
		  },
		   failure:function(msg){
			   alert(eval('('+msg.responseText+')').error_text);
		   		
		   },
		   error:function(msg){
			   alert(eval('('+msg.responseText+')').error_text); 
		   }
	});
}

function formatLxsGuideApplyList(dataList){
	if(dataList) {
		//var div = $("#applyListId");
		var div=$("#applyListId tr").eq(5);
		var insertStr="";
		for(var k=0;k<dataList.length;k++){
			insertStr+="<tr class=\"red\">"+
			                "<td class=\"title\">申请带团人：</td>"+
			                "<td>"+
				                ""+dataList[k].name+"（导游证号："+dataList[k].guidenum+"）（联系电话："+dataList[k].phone+"）【<a target=\"_blank\" href=\"dyinfo.jsp?guideId="+dataList[k].id+"\">查看该导游相关资料</a>】"+
				                "<button type=\"button\" value=\"1\" onclick=\"acceptApplyOpt("+dataList[k].id+")\">接受</button>"+
				                //"<button type=\"button\" value=\"2\">拒绝</button>"+
			                "</td>"+
			              "</tr>";
		}
		div.after(insertStr);
	}
}
function loadLxsTeamDetail(id) {
	var objp={};
	 $.ajax({
		  url: '${path}/core/getTravelTeamById?id='+teamId,
		  type: 'POST',
		  timeout: 30000,
		  cache : false,
	      data :objp,
	      async: false,
	      dataType:"json",      
         contentType:"application/json",   
	     // contentType: "application/json; charset=utf-8",
		  success:function(msg){
			  //alert(msg.totalCount)
			  formatLxsTeamDetail(msg.travelTeam);
		  },
		   failure:function(msg){
			   alert(eval('('+msg.responseText+')').error_text);
		   		
		   },
		   error:function(msg){
			   alert(eval('('+msg.responseText+')').error_text); 
		   }
	});
}

function formatLxsTeamDetail(data) {
	$("#titleId").html(data.teamtitle);
	$("#startTimeId").html(data.startTime);
	$("#sourcecityId").html(data.sourcecity);
	$("#targetcityId").html(data.targetcity);
	$("#isoutboundId").html(data.isoutbound==1?"是":"否");
	$("#daysId").html(data.days);
	$("#tripId").html(data.trip);
	
}

</script>
</html>
